home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / diskutil / flashfmt.lzh / FLASHFMT.LST < prev    next >
File List  |  1990-02-01  |  3KB  |  127 lines

  1. ' Format Demo to write FAST FORMATTED DISKS vs. .02
  2. ' Steve Crunk 1/30/90
  3. '
  4. ' Hey, it's just a demo...
  5. ' So it doesn't have all the error trapping and glitzy stuff. It works.
  6. '
  7. CLS
  8. '
  9. ' get graphics rez, calcuate offsets and so forth
  10. rez%=XBIOS(4)
  11. IF rez%=0
  12.   offset%=11
  13. ELSE
  14.   offset%=30
  15. ENDIF
  16. DEFTEXT 1,5,0,6-7*(rez%=2)
  17. TEXT 80-150*(rez%<>0),10-10*(rez%=2),"The FLASH FORMATTER"
  18. DEFTEXT 1,0,0,6
  19. '
  20. ' Parameters for Format call are:
  21. ' drv%=Drive Number
  22. ' sid%=1 for single sided ; 2 for double sided
  23. ' trk%=Number of tracks (usually 80, but 81 and 82 are possible)
  24. ' spt%=Number of sectors per track (9 is normal, but 10 is also ok)
  25. ' med%=media number (even for single sided, odd for double sided)
  26. ' intl%=interleave (if interleave is not one, then 11 is assumed)
  27. '                  defaults for # sectors becomes 9 if interleave of 11 is used
  28. '
  29. DO
  30.   msg$="Insert disk to|format in Drive A"
  31.   ALERT 1,msg$,1,"GO ON|ABORT",ans
  32.   IF ans=1
  33.     @format(0,2,80,9,101,11)
  34.     ' this call would format a double sided diskette with 80 tracks and 9
  35.     ' sectors per track, in fast format, in drive a.
  36.   ENDIF
  37.   PRINT AT(offset%,3);"                         ";
  38.   PRINT AT(offset%,4);"                         ";
  39.   msg$=" Format another disk? "
  40.   ALERT 2,msg$,1,"YES|END",ans
  41. LOOP UNTIL ans=2
  42. END
  43. '
  44. '
  45. PROCEDURE format(drv%,sid%,trk%,spt%,med%,intl%)
  46.   ON ERROR GOSUB error_handler
  47.   IF drv%=0
  48.     driv$="A"
  49.   ELSE
  50.     driv$="B"
  51.   ENDIF
  52.   msg$=" Are you SURE you | want to format | drive "+driv$+"?"
  53.   ALERT 3,msg$,1,"GO AHEAD| STOP! ",ans
  54.   IF ans=1
  55.     IF intl%<>1
  56.       spt%=9
  57.     ENDIF
  58.     buf$=STRING$(10500,0)
  59.     VOID FRE(0)
  60.     buf%=VARPTR(buf$)
  61.     reformat:
  62.     cnt%=0
  63.     IF rez%=0
  64.       BOX 78,70,241,104
  65.       BOX 76,68,243,106
  66.     ELSE IF rez%=1
  67.       BOX 227,70,396,104
  68.       BOX 223,68,400,106
  69.     ELSE
  70.       BOX 227,142,396,208
  71.       BOX 225,140,398,210
  72.     ENDIF
  73.     SGET temp$
  74.     dash1$="-"+CHR$(27)+"D"
  75.     dash2$="*"
  76.     FOR t%=0 TO trk%-1
  77.       FOR s%=0 TO sid%-1
  78.         e%=XBIOS(10,L:buf%,L:0,drv%,spt%,t%,s%,intl%,L:&H87654321,&HE5E5)
  79.         IF e%=-13
  80.           ERROR 70
  81.         ELSE IF e%
  82.           PRINT AT(1,18);"Side ";s%;" track ";t%;" Error ";e%;" sector ";
  83.           b%=buf%
  84.           WHILE DPEEK(b%)
  85.             PRINT DPEEK(b%);" ";
  86.             ADD b%,2
  87.           WEND
  88.         ELSE
  89.           IF cnt%=0
  90.             HTAB offset%
  91.             VTAB 10
  92.           ENDIF
  93.           INC cnt%
  94.           IF cnt%=40 OR cnt%=80 OR cnt%=120
  95.             PRINT dash1$
  96.             HTAB offset%
  97.           ELSE
  98.             PRINT dash1$;
  99.           ENDIF
  100.           SWAP dash1$,dash2$
  101.         ENDIF
  102.       NEXT s%
  103.     NEXT t%
  104.     ' ----- zero buffer
  105.     buf$=STRING$(10500,0)
  106.     buf%=V:buf$
  107.     ' ----- write buffer to FAT and Directory
  108.     ~XBIOS(9,L:buf%,L:0,drv%,1,0,0,9)
  109.     ~XBIOS(9,L:buf%,L:0,drv%,1,0,1,9)
  110.     ' ----- create & write the boot sector
  111.     ~XBIOS(18,L:buf%,L:&H1111111,sid%+1,0)
  112.     ~XBIOS(9,L:buf%,L:0,drv%,1,0,0,1)
  113.     PRINT
  114.     PRINT AT(offset%+1,3);DFREE(drv%+1);" Bytes free   "
  115.     PRINT AT(offset%+1,4);"press any key..."
  116.     ~INP(2)
  117.   ENDIF
  118.   SPUT temp$
  119.   SHOWM
  120. RETURN
  121. PROCEDURE error_handler
  122.   msg$="Disk is WRITE PROTECTED|or MISSING. Please fix|before continuing"
  123.   ALERT 3,msg$,1," OK ",ans
  124.   ON ERROR GOSUB error_handler
  125.   RESUME reformat
  126. RETURN
  127.